import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@sw-ui": path.resolve(__dirname, "packages"),
    },
  },
  build: {
    lib: {
      entry: path.resolve(__dirname, "packages/index.ts"),
      name: "SWUI",
      fileName: (format) => `sw-ui.${format}.js`,
    },
    rollupOptions: {
      external: ["vue", "element-plus", "vxe-table"],
      output: {
        globals: {
          vue: "Vue",
          "element-plus": "ElementPlus",
          "vxe-table": "VXETable",
        },
      },
    },
  },
});
